package design.simdi.code.final_paper.core.entities;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * 
 * @author Marius Dumitriu - (Jun 21, 2010 - 12:38:50 PM)
 * 
 */
@Entity
@Table(name = "keywords")
@AttributeOverrides( { @AttributeOverride(name = "id", column = @Column(name = "Keyword_Id")) })
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Keyword extends ApplicationEntity implements Cloneable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String name;
	private String description;
	private Person person;

	public void setName(String name) {
		this.name = name;
	}

	@Column(length = 250, nullable = false, name = "Name")
	public String getName() {
		return name;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	@ManyToOne
	@JoinColumn(name = "Person_Fk")
	public Person getPerson() {
		return person;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(length = 1000, name = "Description")
	public String getDescription() {
		return description;
	}

	public Keyword clone() {
		Keyword clone = new Keyword();
		clone.setName(name);
		clone.setDescription(getDescription());
		return clone;

	}

}
